#include<stdio.h>
#include<string.h>

struct person
{
	char name[16];
	int age;
	char sex;
};

struct student
{
	struct person stu;
	float score;
};

struct teacher
{
	struct person tea;
	char phone[12];
};

int main(){
	//1.通过结构体变量赋值
	struct student s;
	strcpy(s.stu.name, "zhangsan");
	s.stu.age = 12;
	s.stu.sex = 'm';
	s.score = 98;
	printf("name = %s, age = %d, sex = %c, score = %f\n",s.stu.name, s.stu.age, s.stu.sex, s.score);

	//2. 通过结构体指针赋值
	struct teacher t;
	struct teacher *pt = &t;
	strcpy(pt->tea.name, "lisi");
	pt->tea.age = 15;
	pt->tea.sex = 'm';
	strcpy(pt->phone, "15572159327");

	printf("name = %s, age = %d, sex = %c, phone = %s\n",pt->tea.name, pt->tea.age, pt->tea.sex, pt->phone);
	return 0;
}
